﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Windows.Forms;
using QuanLiNhaSachDAO;
using QuanLiNhaSachDTO;
namespace QuanLiNhaSachBUS
{
    public class NhanVienBUS
    {
        public static DataTable login(string username, string password)
        {
            try
            {
                return NhanVienDAO.login(username, password);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi đăng nhập");
            }
            return null;
        }

        public static DataTable loadAll()
        {
            try
            {
                return NhanVienDAO.selectAll();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi load");
            }
            return null;
        }
        public static void insert(NhanVien m)
        {
            try
            {
                NhanVienDAO.insert(m);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi thêm");
            }
        }
        public static void update(NhanVien m)
        {
            try
            {
                NhanVienDAO.update(m);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi chỉnh sửa");
            }
        }

        public static void delete(string id)
        {
            try
            {
                NhanVienDAO.delete(id);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi xóa");
            }
        }
    }
}
